; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=gvn -S | FileCheck %s

define ptr addrspace(1) @addrspacecast(ptr %ptr) {
; CHECK-LABEL: @addrspacecast(
; CHECK-NEXT:  block1:
; CHECK-NEXT:    [[Z1:%.*]] = addrspacecast ptr [[PTR:%.*]] to ptr addrspace(1)
; CHECK-NEXT:    store ptr addrspace(1) [[Z1]], ptr undef
; CHECK-NEXT:    ret ptr addrspace(1) [[Z1]]
;
block1:
  %z1 = addrspacecast ptr %ptr to ptr addrspace(1)
  store ptr addrspace(1) %z1, ptr undef
  br label %block2

block2:
  %z2 = addrspacecast ptr %ptr to ptr addrspace(1)
  ret ptr addrspace(1) %z2
}
